package mysql

import (
	"github.com/go-xorm/xorm"
	"note/service/repository"
)

type goodsOrderRepository struct {
	db *xorm.Engine
}

func NewGoodsOrderRepository(db *xorm.Engine) repository.GoodsOrderRepository {
	return &goodsOrderRepository{db: db}
}

func (self *goodsOrderRepository) InsertOne(doc *repository.GoodsOrder) (id int64, err error) {
	return self.db.InsertOne(doc)
}

func (self *goodsOrderRepository) FindById(filter interface{}) (*repository.GoodsOrder, error) {
	doc := &repository.GoodsOrder{}
	_, err := self.db.Where("id=?", filter).Get(doc)
	return doc, err
}
